import axios from './index'
import qs from 'qs'

// 获取微信openid
export const getWxOpenId = (data) => {
  return axios.request({
    url: '/wxInfo/getUserInfo?code=' + data,
    method: 'get'
  })
}

// 获取图片、说明
export const getImgExplain = () => {
  return axios.request({
    url: '/homePageSetting/getSystemSetting',
    method: 'get'
  })
}

// 获取所有网点
export const getWebInfoSelect = () => {
  return axios.request({
    url: '/webInfo/selectAllWebInfo',
    method: 'get'
  })
}

// 获取所有户籍地
export const getHouseholdRegisterSelect = () => {
  return axios.request({
    url: '/householdRegister/selectAllHouseholdRegisterList',
    method: 'get'
  })
}

// 根据网点Id获取预约日期
export const getWorkDaySelect = (data) => {
  return axios.request({
    url: '/orderSetting/getWxOrderSettingWorkDay?webId=' + data,
    method: 'get'
  })
}

// 根据网点Id、日期获取预约名额
export const getPeopleNumSelect = (data, day) => {
  return axios.request({
    url: '/orderSetting/getWxOrderSettingInfo?webId=' + data + '&workDay=' + day,
    method: 'get'
  })
}

// 用户预约
export const addStudentOrderInfo = (data) => {
  return axios.request({
    url: '/studentOrder/addStudentOrderInfo',
    method: 'post',
    data
  })
}

// 用户预约列表
export const getStudentOrderInfoList = (data) => {
  return axios.request({
    url: '/studentOrder/getStudentOrderInfoList',
    method: 'post',
    data: qs.stringify(data)
  })
}

// 取消预约
export const cancelStudentOrderInfo = (data) => {
  return axios.request({
    url: '/studentOrder/cancelStudentOrderInfo',
    method: 'post',
    data: qs.stringify(data)
  })
}
